package com.melesta.engine;

import android.opengl.GLSurfaceView.Renderer;
import android.view.KeyEvent;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

public class Renderer
  implements GLSurfaceView.Renderer
{
  private int mReinit;
  private int mScreenHeight;
  private int mScreenWidth;

  private static native void nativeDeleteBackward();

  private static native String nativeGetContentText();

  private static native void nativeInit(int paramInt1, int paramInt2);

  private static native void nativeInsertText(String paramString);

  private static native boolean nativeKeyDown(int paramInt);

  private static native boolean nativeKeyUp(int paramInt);

  private static native void nativeOnPause();

  private static native void nativeOnResume();

  private static native void nativeReloadProfile();

  private static native void nativeRender();

  private static native void nativeSetRotation(int paramInt);

  private static native void nativeTouchesBegin(int paramInt, float paramFloat1, float paramFloat2);

  private static native void nativeTouchesCancel(int[] paramArrayOfInt, float[] paramArrayOfFloat1, float[] paramArrayOfFloat2);

  private static native void nativeTouchesEnd(int paramInt, float paramFloat1, float paramFloat2);

  private static native void nativeTouchesMove(int[] paramArrayOfInt, float[] paramArrayOfFloat1, float[] paramArrayOfFloat2);

  public String getContentText()
  {
    return nativeGetContentText();
  }

  public void handleActionCancel(int[] paramArrayOfInt, float[] paramArrayOfFloat1, float[] paramArrayOfFloat2)
  {
    nativeTouchesCancel(paramArrayOfInt, paramArrayOfFloat1, paramArrayOfFloat2);
  }

  public void handleActionDown(int paramInt, float paramFloat1, float paramFloat2)
  {
    nativeTouchesBegin(paramInt, paramFloat1, paramFloat2);
  }

  public void handleActionMove(int[] paramArrayOfInt, float[] paramArrayOfFloat1, float[] paramArrayOfFloat2)
  {
    nativeTouchesMove(paramArrayOfInt, paramArrayOfFloat1, paramArrayOfFloat2);
  }

  public void handleActionUp(int paramInt, float paramFloat1, float paramFloat2)
  {
    nativeTouchesEnd(paramInt, paramFloat1, paramFloat2);
  }

  public void handleDeleteBackward()
  {
    nativeDeleteBackward();
  }

  public void handleInsertText(String paramString)
  {
    if (paramString.endsWith("\n"))
      paramString = paramString.substring(0, -1 + paramString.length());
    nativeInsertText(paramString);
  }

  public void handleKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    switch (paramKeyEvent.getAction())
    {
    default:
      return;
    case 0:
      nativeKeyDown(paramInt);
      return;
    case 1:
    }
    nativeKeyUp(paramInt);
  }

  public void handleOnPause()
  {
    nativeOnPause();
  }

  public void handleOnResume()
  {
    nativeOnResume();
  }

  public void onDrawFrame(GL10 paramGL10)
  {
    if (this.mReinit > 0)
    {
      this.mReinit = (-1 + this.mReinit);
      return;
    }
    EngineActivity.fireBeginTick();
    if (this.mReinit == 0)
    {
      this.mReinit = (-1 + this.mReinit);
      nativeInit(this.mScreenWidth, this.mScreenHeight);
    }
    nativeRender();
    EngineActivity.fireEndTick();
  }

  public void onSurfaceChanged(GL10 paramGL10, int paramInt1, int paramInt2)
  {
    Object[] arrayOfObject = new Object[2];
    arrayOfObject[0] = Integer.valueOf(paramInt1);
    arrayOfObject[1] = Integer.valueOf(paramInt2);
    Log.d("engine", String.format("onSurfaceChanged(%d, %d)", arrayOfObject));
    this.mReinit = (4 + this.mReinit);
  }

  public void onSurfaceCreated(GL10 paramGL10, EGLConfig paramEGLConfig)
  {
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = paramEGLConfig.toString();
    Log.d("engine", String.format("onSurfaceCreated(%s)", arrayOfObject));
    nativeInit(this.mScreenWidth, this.mScreenHeight);
  }

  public void reloadProfile()
  {
    nativeReloadProfile();
  }

  public void setRotation(int paramInt)
  {
    nativeSetRotation(paramInt);
  }

  public void setScreenWidthAndHeight(int paramInt1, int paramInt2)
  {
    this.mScreenWidth = paramInt1;
    this.mScreenHeight = paramInt2;
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.melesta.engine.Renderer
 * JD-Core Version:    0.6.2
 */